package com.java.tutorials.jdk7.locale;
import java.text.DateFormat;
import java.util.Calendar;
import java.util.Locale;
/**
 * Created by xuzhike on 2016/1/27.
 * http://www.java2s.com/Code/Java/JDK-7/UsingtheLocaleCategoryenumerationtodisplayinformationusingtwodifferentlocales.htm
 * Using the Locale.Category enumeration to display information using two different locales
 */
public class LocaleCategoryTest {
    public static void main(String[] args) {
        Locale locale = Locale.getDefault();
        Calendar calendar = Calendar.getInstance();
        calendar.setWeekDate(2012, 16, 3);

        System.out.println(DateFormat.getDateTimeInstance(DateFormat.LONG,
                DateFormat.LONG).format(calendar.getTime()));
        System.out.println("" + locale.getDisplayLanguage());

        Locale.setDefault(Locale.Category.FORMAT, Locale.JAPANESE);
        Locale.setDefault(Locale.Category.DISPLAY, Locale.GERMAN);

        System.out.println(DateFormat.getDateTimeInstance(DateFormat.LONG,
                DateFormat.LONG).format(calendar.getTime()));
        System.out.println("" + locale.getDisplayLanguage());

    }
}
